public class Solution {
    public boolean isPalindrome(String s) {
        StringBuilder filter = new StringBuilder();
        for(char c : s.toCharArray()){
            if(Character.isLetterOrDigit(c)){
                filter.append(Character.toLowerCase(c));
            }
        }
        char[] array = filter.toString().toCharArray();
        int left = 0, right = array.length - 1;
        while(left < right){
            if(array[left] != array[right]){
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
}
